package br.com.projeto.jsoup;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class HttpClientJsoup {

	private static final String URL_ULTIMO_CONCURSO = "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp";
	private static final String URL_CONCURSOS_ANTERIOES = "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp?submeteu=sim&opcao=concurso&txtConcurso=";

	public static String[] httpGetLast() throws IOException {
		Document document = Jsoup.connect(URL_ULTIMO_CONCURSO).get();
		return Jsoup.parse(document.toString()).text().split("\\|");
	}

	public static String[] httpGetByNumber(String numConcurso) throws IOException {
		Document document = Jsoup.connect(URL_CONCURSOS_ANTERIOES + numConcurso).get();
		return Jsoup.parse(document.toString()).text().split("\\|");
	}
}
